<!-- top nav -->
<nav class="navbar navbar-inverse navbar-fixed-top">
	<div class="container-fluid">
		<div class="navbar-header">
			<a class="navbar-brand" href="/admin/app/index">{$__settings[admin_title]}</a>
		</div>
		<div id="navbar" class="navbar-collapse collapse">
			<ul class="nav navbar-nav navbar-right">
				<li class="dropdown">
					<a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">您好，{$loginUser->getName()} <span class="caret"></span></a>
					<ul class="dropdown-menu user" role="menu">
						<li><a href="#" id="manager-profile"><i class="glyphicon glyphicon-user"></i> 个人资料</a></li>
						<li><a href="#" id="manager-pass"><i class="glyphicon glyphicon-edit"></i> 修改密码</a></li>
						<li><a href="/admin/login/logout"><i class="glyphicon glyphicon-off"></i> 退出登陆</a></li>
					</ul>
				</li>
			</ul>
		</div>
	</div>
</nav>

<script type="text/html" id="manager-porfile-template">
	<form role="form" class="content-add-form form-horizontal" id="manager-porfile-form" autocomplete="off">

		<div class="form-group">
			<label class="col-sm-2 control-label"><span class="asterisk">*</span> 用户名</label>
			<div class="col-sm-10">
				<input type="text" class="form-control" value="{$loginUser->getUsername()}" readonly />
			</div>
		</div>

		<div class="form-group">
			<label class="col-sm-2 control-label"><span class="asterisk">*</span> 角色</label>
			<div class="col-sm-10">
				<input type="text" class="form-control" value="{expr $loginUser->getRoleName()?$loginUser->getRoleName():'超级管理员'}" readonly />
			</div>
		</div>

		<div class="form-group">
			<label class="col-sm-2 control-label"><span class="asterisk">*</span> 手机号码</label>
			<div class="col-sm-10">
				<input type="text" dtype="mobile" name="data[mobile]" value="{$loginUser->getMobile()}" class="form-control" placeholder="手机号码" required/>
				<p class="help-block"></p>
			</div>
		</div>

		<div class="form-group">
			<label class="col-sm-2 control-label"><span class="asterisk">*</span> 姓名</label>
			<div class="col-sm-10">
				<input type="text" name="data[name]" value="{$loginUser->getName()}" class="form-control" placeholder="姓名" maxlength="10" required/>
				<p class="help-block"></p>
			</div>
		</div>

		<div class="form-group">
			<label class="col-sm-2 control-label"><!--<span class="asterisk">*</span>--> 工号</label>
			<div class="col-sm-10">
				<input type="text" name="data[jobno]" value="{$loginUser->getJobno()}" dtype="number" class="form-control" maxlength="5" placeholder="工号" required/>
				<p class="help-block">不超过5位数字</p>
			</div>
		</div>

		<div class="form-group">
			<label class="col-sm-2 control-label">邮箱</label>
			<div class="col-sm-10">
				<input type="text" name="data[email]" value="{$loginUser->getEmail()}" maxlength="30" class="form-control" placeholder="邮箱" />
				<p class="help-block"></p>
			</div>
		</div>

		<div class="form-group">
			<label class="col-sm-2 control-label"><span class="asterisk">*</span> 账户状态</label>
			<div class="col-sm-10">
				<div>
					<input type="checkbox" class="bswitch bswitch-add" disabled {if $loginUser->getStatus()==1}checked{/if} data-on-text="正常" data-off-text="禁用">
				</div>
			</div>
		</div>

		<div class="form-group">
			<label class="col-sm-2 control-label">简介</label>
			<div class="col-sm-10">
				<textarea name="data[summary]" class="form-control" maxlength="100" placeholder="这里输入管理员简介">{$loginUser->getSummary()}</textarea>
				<p class="help-block"></p>
			</div>
		</div>

	</form>
</script>

<script type="text/html" id="manager-pass-template">
	<form role="form" class="content-add-form" id="manager-pass-form" autocomplete="off">

		<div class="form-element">
			<div class="form-group">
				<label><span class="asterisk">*</span> 新密码</label>
				<input type="password" name="password" class="form-control" id="password" handler="__checkPass__(value, ele)" min-length="6" maxlength="20" placeholder="新密码" required />
			</div>
			<p class="help-block">请输入6-20位的密码</p>
		</div>
		<div class="form-element">
			<div class="form-group">
				<label><span class="asterisk">*</span> 确认密码</label>
				<input type="password" dtype="repass" for-password="password" class="form-control" min-length="6" maxlength="20" placeholder="确认密码" required />
			</div>
			<p class="help-block">请输入6-20位的密码</p>
		</div>

	</form>
</script>

<script>
	function __checkPass__(value, ele) {
		if ( /^\d+$/.test(value) ) {
			$(ele).parent().next().addClass("text-error").html('密码不能为纯数字');
			ele.focus();
			return false;
		}
		if ( /^[a-z|a-z]+$/.test(value) ) {
			$(ele).parent().next().addClass("text-error").html('密码不能为纯字母');
			ele.focus();
			return false;
		}
		return true;
	}
</script>